const express = require('express')
const router = express.Router()

router.get('/user/menu', (req, res) => {
  const type = req.query.type
  if (type === 'admin') {
    const data = {
      code: 200,
      data: [
        {
          name: 'index',
          id: '/index',
          icon: 'layui-icon-home',
          title: '首页',
          sort: 0,
          isShow: true,
          type: '菜单'
        },
        {
          name: 'orderManagement',
          id: '/orderManagement',
          icon: 'layui-icon-list',
          title: '订单管理',
          sort: 1,
          isShow: true,
          type: '目录',
          children: [
            {
              name: 'orderHistory',
              id: '/orderManagement/orderHistory',
              icon: 'layui-icon-form',
              title: '订单记录',
              sort: 0,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'threeDayOrderTrend',
              id: '/orderManagement/threeDayOrderTrend',
              icon: 'layui-icon-chart',
              title: '三日订单走势',
              sort: 1,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'billingProcessing',
              id: '/orderManagement/billingProcessing',
              icon: 'layui-icon-templeate-one',
              title: '话费处理',
              sort: 2,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'supplementaryOrderProcessing',
              id: '/orderManagement/supplementaryOrderProcessing',
              icon: 'layui-icon-table',
              title: '补单处理',
              sort: 3,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'supplementRecords',
              id: '/orderManagement/supplementRecords',
              icon: 'layui-icon-file-b',
              title: '补单记录',
              sort: 4,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'fujianUnifiedPaymentInquiry',
              id: '/orderManagement/fujianUnifiedPaymentInquiry',
              icon: 'layui-icon-template',
              title: '福建统付查询',
              sort: 5,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'interceptLogs',
              id: '/orderManagement/interceptLogs',
              icon: 'layui-icon-video',
              title: '拦截日志',
              sort: 6,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'orderCallbacks',
              id: '/orderManagement/orderCallbacks',
              icon: 'layui-icon-file-b',
              title: '订单回调',
              sort: 7,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'groupLogs',
              id: '/orderManagement/groupLogs',
              icon: 'layui-icon-template',
              title: '集团日志',
              sort: 8,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'historicalOrders',
              id: '/orderManagement/historicalOrders',
              icon: 'layui-icon-template',
              title: '历史订单',
              sort: 9,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'operationLogs',
              id: '/orderManagement/operationLogs',
              icon: 'layui-icon-template',
              title: '操作日志',
              sort: 10,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'blacklist',
              id: '/orderManagement/blacklist',
              icon: 'layui-icon-template',
              title: '黑名单',
              sort: 11,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'cacheConfiguration',
              id: '/orderManagement/cacheConfiguration',
              icon: 'layui-icon-template',
              title: '缓存配置',
              sort: 12,
              isShow: true,
              type: '菜单'
            }
          ]
        },
        {
          name: 'topUpCardManagement',
          id: '/topUpCardManagement',
          icon: 'layui-icon-cart-simple',
          title: '充值卡管理',
          sort: 2,
          isShow: true,
          type: '目录',
          children: [
            {
              name: 'cardInventoryManagement',
              id: '/topUpCardManagement/cardInventoryManagement',
              icon: 'layui-icon-user',
              title: '卡库存管理',
              sort: 0,
              isShow: true,
              type: '菜单'
            }
          ]
        },

        {
          name: 'channelManagement',
          id: '/channelManagement',
          icon: 'layui-icon-app',
          title: '渠道管理',
          sort: 3,
          isShow: true,
          type: '目录',
          children: [
            {
              name: 'dispatchConfiguration',
              id: '/channelManagement/dispatchConfiguration',
              icon: 'layui-icon-location',
              title: '派单管理',
              sort: 0,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'andOtherCallbackThresholds',
              id: '/channelManagement/andOtherCallbackThresholds',
              icon: 'layui-icon-location',
              title: '等回调阈值管理',
              sort: 1,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'channelConfigurationProvince',
              id: '/channelManagement/channelConfigurationProvince',
              icon: 'layui-icon-layer',
              title: '渠道配置（省）',
              sort: 2,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'channelConfigurationCity',
              id: '/channelManagement/channelConfigurationCity',
              icon: 'layui-icon-tabs',
              title: '渠道配置（市）',
              sort: 3,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'deliveryConfigurationProvince',
              id: '/channelManagement/deliveryConfigurationProvince',
              icon: 'layui-icon-log',
              title: '供货配置（省）',
              sort: 4,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'deliveryConfigurationCity',
              id: '/channelManagement/deliveryConfigurationCity',
              icon: 'layui-icon-log',
              title: '供货配置（市）',
              sort: 5,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'supplyPriceAdjustmentDetails',
              id: '/channelManagement/supplyPriceAdjustmentDetails',
              icon: 'layui-icon-log',
              title: '供货调价明细',
              sort: 6,
              isShow: true,
              type: '菜单'
            }
          ]
        },

        {
          name: 'directive',
          id: '/directive',
          icon: 'layui-icon-test',
          title: '内置指令',
          sort: 2,
          isShow: true,
          type: '目录',
          children: [
            {
              name: 'permission',
              id: '/directive/permission',
              icon: 'layui-icon-template',
              title: '权限指令',
              sort: 0,
              isShow: true,
              type: '菜单'
            }
          ]
        },
        {
          name: 'page',
          id: '/page',
          icon: 'layui-icon-link',
          title: '外链页面',
          sort: 3,
          isShow: true,
          type: '目录',
          children: [
            {
              id: 'http://192.168.88.23:88/orderManagement/threeDayOrderTrend',
              icon: 'layui-icon-home',
              title: '弹层外链',
              type: 'modal',
              sort: 0,
              isShow: true
            },
            {
              id: 'https://www.baidu.com',
              icon: 'layui-icon-layouts',
              title: '原生跳转',
              type: 'blank',
              sort: 1,
              isShow: true
            }
          ]
        },
        {
          name: 'enrollee',
          id: '/enrollee',
          icon: 'layui-icon-slider',
          title: '个人中心',
          sort: 4,
          isShow: true,
          type: '目录',
          children: [
            {
              name: 'profile',
              id: '/enrollee/profile',
              icon: 'layui-icon-username',
              title: '我的资料',
              sort: 0,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'message',
              id: '/enrollee/message',
              icon: 'layui-icon-email',
              title: '我的消息',
              sort: 1,
              isShow: true,
              type: '菜单'
            }
          ]
        },
        {
          name: 'system',
          id: '/system',
          icon: 'layui-icon-set',
          title: '系统管理',
          sort: 5,
          isShow: true,
          type: '目录',
          children: [
            {
              name: 'user',
              id: '/system/user',
              icon: 'layui-icon-user',
              title: '用户管理',
              sort: 0,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'role',
              id: '/system/role',
              icon: 'layui-icon-user',
              title: '角色管理',
              sort: 1,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'menu',
              id: '/system/menu',
              icon: 'layui-icon-spread-left',
              title: '菜单管理',
              sort: 2,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'organization',
              id: '/system/organization',
              icon: 'layui-icon-transfer',
              title: '机构管理',
              sort: 3,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'dictionary',
              id: '/system/dictionary',
              icon: 'layui-icon-read',
              title: '字典管理',
              sort: 4,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'file',
              id: '/system/file',
              icon: 'layui-icon-file',
              title: '文件管理',
              sort: 5,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'login',
              id: '/system/login',
              icon: 'layui-icon-date',
              title: '登录日志',
              sort: 6,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'option',
              id: '/system/option',
              icon: 'layui-icon-survey',
              title: '操作日志',
              sort: 7,
              isShow: true,
              type: '菜单'
            }
          ]
        }
      ],
      msg: '操作成功'
    }

    res.json(data)
  } else if (type === 'user') {
    const data = {
      code: 200,
      data: [
        {
          name: 'index',
          id: '/index',
          icon: 'layui-icon-test',
          title: '首页',
          sort: 0,
          isShow: true,
          type: '菜单'
        },
        {
          name: 'orderManagement',
          id: '/orderManagement',
          icon: 'layui-icon-test',
          title: '订单管理',
          sort: 1,
          isShow: true,
          type: '目录',
          children: [
            {
              name: 'orderHistory',
              id: '/orderManagement/orderHistory',
              icon: 'layui-icon-template',
              title: '订单记录',
              sort: 0,
              isShow: true,
              type: '菜单'
            }
            // {
            //   name: 'threeDayOrderTrend',
            //   id: '/orderManagement/threeDayOrderTrend',
            //   icon: 'layui-icon-template',
            //   title: '三日订单走势',
            //   sort: 1,
            //   isShow: true,
            //   type: '菜单'
            // }
          ]
        },
        {
          name: 'directive',
          id: '/directive',
          icon: 'layui-icon-test',
          title: '内置指令',
          sort: 2,
          isShow: true,
          type: '目录',
          children: [
            {
              name: 'permission',
              id: '/directive/permission',
              icon: 'layui-icon-template',
              title: '权限指令',
              sort: 0,
              isShow: true,
              type: '菜单'
            }
          ]
        },
        {
          name: 'page',
          id: '/page',
          icon: 'layui-icon-link',
          title: '外链页面',
          sort: 3,
          isShow: true,
          type: '目录',
          children: [
            // {
            //   id: "https://www.baidu.com",
            //   icon: "layui-icon-home",
            //   title: "弹层外链",
            //   type: "modal",
            //   sort: 0,
            //   isShow: true,
            // },
            {
              id: 'https://www.baidu.com',
              icon: 'layui-icon-layouts',
              title: '原生跳转',
              type: 'blank',
              sort: 1,
              isShow: true
            }
          ]
        },
        {
          name: 'enrollee',
          id: '/enrollee',
          icon: 'layui-icon-slider',
          title: '个人中心',
          sort: 4,
          isShow: true,
          type: '目录',
          children: [
            {
              name: 'profile',
              id: '/enrollee/profile',
              icon: 'layui-icon-username',
              title: '我的资料',
              sort: 0,
              isShow: true,
              type: '菜单'
            },
            {
              name: 'message',
              id: '/enrollee/message',
              icon: 'layui-icon-email',
              title: '我的消息',
              sort: 1,
              isShow: true,
              type: '菜单'
            }
          ]
        }
      ],
      msg: '操作成功'
    }

    res.json(data)
  }
})

module.exports = router
